CREATE DATABASE rerspring
  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'Italian_Italy.1252'
       LC_CTYPE = 'Italian_Italy.1252'
       CONNECTION LIMIT = -1;


-- Table: t_ass_menu_grafico

-- DROP TABLE t_ass_menu_grafico;

CREATE TABLE t_ass_menu_grafico
(
  id bigint NOT NULL,
  id_menu bigint,
  id_grafico bigint,
  id_user bigint,
  id_group bigint,
  CONSTRAINT pk_t_ass_menu_grafico PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_ass_menu_grafico
  OWNER TO postgres;

  -- Table: t_ass_menu_mappa

-- DROP TABLE t_ass_menu_mappa;

CREATE TABLE t_ass_menu_mappa
(
  id bigint NOT NULL,
  id_menu bigint,
  id_mappa bigint,
  id_user bigint,
  id_group bigint,
  CONSTRAINT pk_t_ass_menu_mappa PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_ass_menu_mappa
  OWNER TO postgres;

  -- Table: t_ass_menu_user

-- DROP TABLE t_ass_menu_user;

CREATE TABLE t_ass_menu_user
(
  id bigint NOT NULL,
  id_menu bigint,
  id_user bigint,
  selected boolean,
  active boolean,
  CONSTRAINT pk_t_ass_menu_user PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_ass_menu_user
  OWNER TO postgres;

  -- Table: t_grafico

-- DROP TABLE t_grafico;

CREATE TABLE t_grafico
(
  id_grafico bigint NOT NULL,
  nome character varying,
  tipo character varying,
  class_name character varying,
  stacked boolean,
  legend boolean,
  labels character varying,
  series character varying,
  CONSTRAINT pk_id_grafico PRIMARY KEY (id_grafico)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_grafico
  OWNER TO postgres;

  -- Table: t_left_menu

-- DROP TABLE t_left_menu;

CREATE TABLE t_left_menu
(
  id character varying NOT NULL,
  id_parent character varying,
  nome character varying,
  value character varying,
  open boolean,
  selected boolean,
  active boolean,
  class_name character varying,
  include character varying,
  short_name character varying,
  "order" bigint,
  CONSTRAINT pk_t_left_menu PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_left_menu
  OWNER TO postgres;

  -- Table: t_mappa

-- DROP TABLE t_mappa;

CREATE TABLE t_mappa
(
  id_mappa bigint NOT NULL,
  campo character varying,
  num_classi bigint,
  da_colore character varying,
  a_colore character varying,
  tipo_mappa character varying,
  json_dati text,
  url_json_dati character varying,
  campo_label character varying,
  json_dati_point text,
  url_json_dati_point character varying,
  CONSTRAINT pk_t_mappe PRIMARY KEY (id_mappa)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_mappa
  OWNER TO postgres;

  -- Table: t_mappa_range

-- DROP TABLE t_mappa_range;

CREATE TABLE t_mappa_range
(
  id_range bigint NOT NULL,
  id_mappa bigint,
  da_valore bigint,
  a_valore bigint,
  numero_range bigint,
  CONSTRAINT pk_t_mappa_range PRIMARY KEY (id_range)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_mappa_range
  OWNER TO postgres;

  -- Table: t_menu

-- DROP TABLE t_menu;

CREATE TABLE t_menu
(
  id bigint NOT NULL,
  id_parent bigint,
  nome character varying,
  value character varying,
  open boolean,
  class_name character varying,
  short_name character varying,
  "order" bigint,
  CONSTRAINT pk_t_menu PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_menu
  OWNER TO postgres;

  -- Table: t_menu_preferiti

-- DROP TABLE t_menu_preferiti;

CREATE TABLE t_menu_preferiti
(
  id bigint NOT NULL,
  id_parent bigint,
  id_user bigint,
  id_menu bigint,
  nome character varying,
  CONSTRAINT pk_t_menu_preferiti PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_menu_preferiti
  OWNER TO postgres;

  -- Table: t_preferiti_grafico_mappa

-- DROP TABLE t_preferiti_grafico_mappa;

CREATE TABLE t_preferiti_grafico_mappa
(
  id bigint NOT NULL,
  id_user bigint,
  id_grafico bigint,
  id_mappa bigint,
  nome character varying,
  CONSTRAINT pk_t_preferiti_grafico_mappa PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_preferiti_grafico_mappa
  OWNER TO postgres;

  -- Table: t_preferiti_left_menu

-- DROP TABLE t_preferiti_left_menu;

CREATE TABLE t_preferiti_left_menu
(
  id bigint NOT NULL,
  id_parent bigint,
  id_user bigint,
  id_left_menu character varying,
  nome character varying,
  CONSTRAINT pk_t_preferiti_left_menu PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_preferiti_left_menu
  OWNER TO postgres;

  -- Table: t_user

-- DROP TABLE t_user;

CREATE TABLE t_user
(
  id bigint NOT NULL,
  nome character varying,
  cognome character varying,
  username character varying,
  CONSTRAINT pk_t_user PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE t_user
  OWNER TO postgres;
